package com.meeting.order.common;
/**
 * 统一返回结果
 * @param <T>
 */
public class ResponseResult<T> {
    private int code;
    private String msg;
    private T data;

    public ResponseResult(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    // 成功
    public static <T> ResponseResult<T> success(T data){
        return new ResponseResult<T>(200, "success", data);
    }
    // 失败
    public static <T> ResponseResult<T> error(int code, String msg){
        return new ResponseResult<T>(code, msg, null);
    }
    //Geter and Setter
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public T getData(){
        return data;
    }
    public void setData(T data){
        this.data = data;
    }
}
